package com.example.controller;

import org.springframework.web.bind.annotation.*;

import java.awt.print.Book;

//Rest模式
@RestController
@RequestMapping("/books")
public class BookController {

    @PostMapping
    public String save(@RequestBody Book book) {
        System.out.println("user save..." + book);
        return "{'module':'user save'}";
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id) {
        System.out.println("user delete..." + id);
        return "{'module':'user delete'}";
    }

    @PutMapping
    public String update(@RequestBody Book book) {
        System.out.println("book update..." + book);
        return "{'module':'book update'}";
    }

    @GetMapping("/{id}")
    public String getBuyId(@PathVariable Integer id) {
        System.out.println("book getBuyId..." + id);
        return "{'module':'book getBuyId'}";
    }

    @GetMapping
    public String geAll() {
        System.out.println("book geAll...");
        return "{'module':'book geAll'}";
    }
}